<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>设备维护计划</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
</head>
<body>
  <div class="layui-fluid">   
    <div class="layui-card-header plan-title">设备维护计划</div>
    <div class="layui-card">
      <div class="layui-card-body">
        <div style="padding-bottom: 10px">
          <div class="layui-form layui-card-header layuiadmin-card-header-auto">
              <div class="layui-inline">
                  <label class="layui-form-label">编号:</label>
                  <div class="layui-input-block">
                      <input type="text" name="eid" placeholder="请输入" autocomplete="off" class="layui-input">
                  </div>
              </div>
              <div class="layui-inline">
                  <label class="layui-form-label">专业:</label>
                  <div class="layui-input-block">
                      <select name="doMain" id="majorList" lay-filter="majorListFilter">
                          <option value="">请选择</option>
                      </select>
                  </div>
              </div>
              <div class="layui-inline">
                  <label class="layui-form-label">系统名:</label>
                  <div class="layui-input-block">
                      <select name="systemName" id="systemList" lay-filter='systemListFilter'>
                          <option value="">请选择</option>
                      </select>
                  </div>
              </div>
              <div class="layui-inline">
                  <label class="layui-form-label">设备名:</label>
                  <div class="layui-input-block">
                      <select name="eventName" id="equipmentList" lay-filter="equipmentList">
                          <option value="">请选择</option>
                      </select>
                  </div>
              </div>
            <div class="layui-inline">
              <label class="layui-form-label">车站:</label>
              <div class="layui-input-block">
                  <select name="stationName" id="stationList" lay-filter="stationListFilter">
                      <option value="">请选择</option>
                  </select>
              </div>
            </div>
              <div class="layui-inline">
                  <label class="layui-form-label">工单状态:</label>
                  <div class="layui-input-block">
                      <select name="statu" id="statusList" lay-filter="statusListFilter">
                          <option value="">请选择</option>
                      </select>
                  </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">开始时间</label>
                <div class="layui-input-inline">
                  <i class="layui-icon layui-icon-date"></i>
                  <input type="text" name="startDate" placeholder="请输入" autocomplete="off" class="layui-input" id="startDate">
                </div>
              </div>
              <div class="layui-inline">
                <label class="layui-form-label">结束时间 </label>
                <div class="layui-input-inline">
                  <i class="layui-icon layui-icon-date"></i>
                  <input type="text" name="endDate" placeholder="请输入" autocomplete="off" class="layui-input" id="endtDate">
                </div>
              </div>
              <div class="layui-inline">
                  <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search">
                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                      查询
                  </button>
              </div>
          </div>
        </div>
        <div id="addButton" style="padding-bottom: 10px;"></div>
        <script type="text/html" id="addButtonTpl">
          {{# if(d > -1){ }}
            <button class="layui-btn layuiadmin-btn-admin" data-type="add">添加</button>
          {{# } }}
        </script>
        <table id="LAY-equipment-plan" lay-filter="LAY-equipment-plan"></table>
      </div>
    </div>
  </div>
  <script type="text/html" id="forMaintenanceFlag">
    {{d.isPlan = '计划维修'}}
    <!-- {{#  if(d.isPlan == '1'){d.isPlan = '计划维修'}}
    {{d.isPlan}}
    {{#  } }} -->
</script>
<script type="text/html" id="forTaskStatus">
    {{#  if(d.statu == '0'){d.statu = '已恢复'}}
    {{d.statu}}
    {{#  } else if (d.statu == '1'){d.statu = '处理中' }}
    {{d.statu}}
    {{#  } else if (d.statu == '2'){d.statu = '已搁置' }}
    {{d.statu}}
    {{#  } else if (d.statu == '3'){d.statu = '未处理' }}
    {{d.statu}}
    {{#  } else {d.statu = '已处理' }}
    {{d.statu}}
    {{#  } }}
</script>
<script type="text/html" id="planOperate">
    {{# if((layui.data(layui.setter.tableName).user_info.menuAndPermissionList.indexOf('equipment_maintain_page:detailed_info')) > -1){ }}
        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="detail">查看详情</a>
    {{# } }}
    {{# if((layui.data(layui.setter.tableName).user_info.menuAndPermissionList.indexOf('equipment_maintain_page:delete')) > -1){ }}
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    {{# } }}
</script>
 <script src="../../layuiadmin/layui/layui.js"></script>
  <script src='../../layuiadmin/modules/jTools.js'></script>
  <script>
  layui.config({
    base: '../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
    , my_send: '../myModules/my_send'
  }).use(['index', 'equipment', 'table', 'laytpl','laydate','my_send'], function(){
      var $ = layui.$
      ,form = layui.form
      ,table = layui.table
      , setter = layui.setter
      , laytpl = layui.laytpl
      , my_send = layui.my_send
      , http_proxy = layui.http_proxy
      ,laydate = layui.laydate;

      //按钮权限控制
      var getTpl = addButtonTpl.innerHTML;
      var view = document.getElementById("addButton");
      laytpl(getTpl).render($.inArray('equipment_maintain_page:insert',layui.data(setter.tableName).user_info.menuAndPermissionList),function(html){
          view.innerHTML = html;
      })

      //日期范围
      laydate.render({
        elem: '#startDate'
        ,trigger: 'click'
        ,position:'fixed'
      });
      laydate.render({
        elem: '#endtDate'
        ,trigger: 'click'
        ,position:'fixed'
      });
     //点击查询按钮，重载表格
     form.on('submit(LAY-user-back-search)', function (data) {
        domainArray = data.field.doMain
      ,systemNameArray = data.field.systemName
      ,etNameArray = data.field.eventName
      ,chekDomain = domainArray.indexOf("#@***#!-")
      ,cheksystemName = systemNameArray.indexOf("#@***#!-")
      ,cheketName = etNameArray.indexOf("#@***#!-")
      ,domainStr = data.field.doMain
      ,systemNameStr = data.field.systemName
      ,etNameStr = data.field.eventName;
      if(chekDomain!=-1||chekDomain!='-1'){
          domainStr = domainArray.split("#@***#!-")[0];
      }
      if(cheksystemName!=-1||cheksystemName!='-1'){
          systemNameStr = systemNameArray.split("#@***#!-")[0];
      } 
      if(cheketName!=-1||cheketName!='-1'){
          etNameStr = etNameArray.split("#@***#!-")[0];
      }
      data.field.doMain = domainStr;
      data.field.systemName = systemNameStr;
      data.field.eventName = etNameStr;
    //  data.field.statu = $("#statusList option:selected").text();
      //执行重载
      table.reload('planTableAll', {
        page:{
          curr:1
        }
        ,where: data.field
      });
    });
  
    //事件
    var active = {
      add: function(){
        layer.open({
          type: 2
          ,title: '添加维护计划'
          ,content: 'plan-addForm.html'
          ,area: ['80%', '80%']
          ,btn: ['确定', '取消']
          ,yes: function(index, layero){
            //点击确认触发 iframe 内容中的按钮提交
            var submit = layero.find('iframe').contents().find("#layuiadmin-app-form-submit");
            submit.click();
          }
        }); 
      }
    }  
    $('.layui-btn.layuiadmin-btn-admin').on('click', function(){
      var type = $(this).data('type');
      active[type] ? active[type].call(this) : '';
    });
  });
  </script>
</body>
</html>
